import java.util.Arrays;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: Administrator
 * \* Date: 2021/10/26
 * \* Time: 18:36
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */
public class TestDemo {






    public static boolean isUp(int[]arr){
        for(int i=0;i< arr.length-1;i++){
            if(arr[i]>arr[i+1]){
                return false;
            }
        }
        return true;
    }


    public static void bublleSort(int []arr){

        for(int i=0;i< arr.length-1;i++){
            boolean flag=false;
            for(int j=0;j< arr.length-i-1;j++){
                if(arr[j]>arr[j+1]){
                    int tmp=arr[j];
                    arr[j]=arr[j+1];
                    arr[j+1]=tmp;
                    flag=true;
                }
            }
            if(flag==false){
                break;
            }
        }
    }
    public static void reverse(int[]arr){
        int i=0;
        int j=arr.length-1;
        while (i<j){
            int tmp=arr[i];
            arr[i]=arr[j];
            arr[j]=tmp;
            i++;
            j--;
        }
    }

    public static void main(String[] args) {
        int []arr={11,2,3,14,15};
        reverse(arr);
        System.out.println(Arrays.toString(arr));
    }


//数组的逆置
    public static void main2(String[] args) {
        int[]arr=new int[10];
        Arrays.fill(arr,99);
        System.out.println(Arrays.toString(arr));
    }

    public static void main1(String[] args) {
        int[]arr ={11,12,3,14,15};
        Arrays.sort(arr);
       // bublleSort(arr);
        System.out.println(Arrays.toString(arr));
//        boolean flg=isUp(arr);
//        System.out.println(flg);
    }

}
